home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvmtest / pvm_test_gui < prev    next >
Encoding:
Text File  |  1995-05-22  |  50.2 KB  |  1,278 lines

  1. #! /usr/local/X11R5/bin/wish -f
  2. #
  3. # This program is an interface to the PVM test suite. Written by Emmanual Jeannot
  4. # and Philip Mucci at the University of Tennessee in Knoxville. Help is available
  5. # through cs.utk.edu. Some of the fileselector code was originally written by
  6. # Mario Jorge Silva(msilva@cs.Berkeley.EDU). 
  7. # Philip Mucci (mucci@cs.utk.edu)
  8. # Emmanuel Jeannot (jeannot@cs.utk.edu) (ejeannot@ens.ens-lyon.fr)
  9. #
  10. #
  11. # Default font settings
  12. #
  13. option add *Listbox*font \
  14.     "-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
  15. option add *Entry*font \
  16.     "-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
  17. option add *Label*font \
  18.     "-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
  19. option add *Scale*font \
  20.     "-*-helvetica-medium-r-normal-*-10-*-*-*-p-*-iso8859-1" startupFile
  21. option add *Text*font \
  22.     "6x13" startupFile
  23. #
  24. # Default global variable settings
  25. #
  26. set pvm_test_gui_pid [pid]
  27. set pvm_test_pid 0
  28. set pvm_root ""
  29. set pvm_arch ""
  30. set num_procs 5
  31. set siz_mesgs 100
  32. set num_mesgs 10
  33. set bw_start 100
  34. #set bw_end [expr $bw_start*32]
  35. #set bw_inc [expr $bw_end/64]
  36. set bw_end 1000
  37. set bw_inc 100
  38. set atime_bool 0
  39. set all_comb_bool 0
  40. set ttime_bool 0
  41. set pvm_hostfile ""
  42. set hostfile_buffer ""
  43. set onelabeltest ""
  44. set pvm_test_status ""
  45. set helpmsg "Help messages appear here."
  46.  
  47. #
  48. # Procedures
  49. #
  50.  
  51. proc KillTester { } {
  52.   global pvm_test_pid pvm_test_gui_pid
  53.  
  54.   catch {exec kill -30 $pvm_test_pid}
  55. }
  56.  
  57. proc IsProcessRunning { pid } {
  58.   update
  59.   set processes [string trim [exec ps]]
  60.   if {[regexp "$pid " $processes] == 0} {
  61.     return 0
  62.   } else {
  63.     return 1 }
  64. }
  65.  
  66. proc RunTester { } {
  67.   global pvm_test_gui_pid pvm_test_pid errorCode pvm_root pvm_arch pvm_test_status 
  68.  
  69.   exec rm -f /tmp/ptg.status.$pvm_test_gui_pid
  70.   if { $errorCode != "NONE" } {
  71.     error "Could not remove /tmp/ptg.status.$pvm_test_gui_pid."
  72.     return }
  73.  
  74. # tkwait variable pvm_root
  75. #  exec $pvm_root/lib/pvm &
  76. #  after 4000 
  77.   set pvm_test_pid [exec ~/pvm3/bin/$pvm_arch/pvm_test /tmp/ptg.infile.$pvm_test_gui_pid > /tmp/ptg.status.$pvm_test_gui_pid 2> /tmp/ptg.status.$pvm_test_gui_pid &]
  78.  
  79.   destroy .generic
  80.   PutGeneric .generic
  81.   grab set .generic
  82.   pack .generic -side bottom -anchor sw -expand true -fill both
  83.   button .generic.abort -text ABORT -bd 2 -fg red -command { KillTester }
  84.   label .generic.status -textvariable pvm_test_status -relief sunken -bd 1 -bg white -fg black
  85.   pack .generic.status -side top -fill both -pady 2 -padx 2
  86.   pack .generic.abort -side bottom -fill both -pady 2 -padx 2
  87.  
  88.   set i 0
  89.   while { 1 } {
  90.     set pvm_test_status [exec tail -1 /tmp/ptg.status.$pvm_test_gui_pid]
  91.     update
  92.     if {[expr $i % 5] == 0} {
  93.       if {[expr ($i/5) % 2] == 0} {
  94.     .generic.status configure -bg black -fg white
  95.       } else {
  96.     .generic.status configure -bg white -fg black } }
  97.     if {[expr $i % 10] == 0} {
  98.       if { [IsProcessRunning $pvm_test_pid] == 0} {
  99.         destroy .generic.abort
  100.     break } }
  101.     set i [expr $i + 1]
  102.   }
  103.  
  104.   set pvm_test_status [exec tail -1 /tmp/ptg.status.$pvm_test_gui_pid]
  105.   update
  106.   exec rm -f /tmp/ptg.status.$pvm_test_gui_pid /tmp/ptg.infile.$pvm_test_gui_pid
  107.  
  108.   if {[file exists /tmp/ptg.rpt.$pvm_test_gui_pid] && [file size /tmp/ptg.rpt.$pvm_test_gui_pid]} {
  109.     button .generic.view -text "View/Save results" -bd 2 -command { PutResults } 
  110.   } else {
  111.     button .generic.view -text "View/Save results" -bd 2 -state disabled }
  112.   button .generic.done -text "Done" -bd 2 -command { DoneResultsForGood }
  113.   pack .generic.status -side top -fill both -pady 2 -padx 2
  114.   pack .generic.done .generic.view -side bottom -fill both -padx 2 -pady 2
  115. }
  116.  
  117. proc MakeSel { } {
  118.   global hostfile_buffer
  119.   frame .top.r3panel 
  120.   pack .top.r3panel -side top -expand true -fill both -padx 2 -pady 2 -anchor nw
  121.  
  122.   label .top.r3panel.actions -text "Actions"
  123.   button .top.r3panel.rsel -text "Run selection" -bd 3 -command { RunSel }
  124.   pack .top.r3panel.actions .top.r3panel.rsel  -side top -fill x -padx 3
  125.   bind .top.r3panel.rsel <Enter> { 
  126.     set helpmsg "Guess what this does?" 
  127.     tk_butEnter %W }
  128.  
  129.   label .top.r3panel.select -text "Test groups"
  130.   pack .top.r3panel.select -side top -fill both -padx 3
  131.   checkbutton .top.r3panel.alltests -text "All available tests" -anchor w -variable alltests
  132.   bind .top.r3panel.alltests <Enter> { 
  133.     set helpmsg "Perform all 91 tests. This might take quite a while!" 
  134.     tk_butEnter %W }
  135.   checkbutton .top.r3panel.allmsg -text "All messaging tests" -anchor w -variable allmsg 
  136.   bind .top.r3panel.allmsg <Enter> { 
  137.     set helpmsg "Perform the funneling, head-to-head and triangle tests, both with and without data." 
  138.     tk_butEnter %W }
  139.   checkbutton .top.r3panel.allrtin  -text "All routine tests" -anchor w -variable allrtin
  140.   bind .top.r3panel.allrtin <Enter> { 
  141.     set helpmsg "Perform tests on the host, group, buffer, task, broadcast and other functions." 
  142.     tk_butEnter %W }
  143.   checkbutton .top.r3panel.fdat -text "All funneling tests with data" -anchor w -variable fdat
  144.   bind .top.r3panel.fdat <Enter> { 
  145.     set helpmsg "Perform the test where one host gathers messages from many." 
  146.     tk_butEnter %W }
  147.   checkbutton .top.r3panel.fndat -text "All funneling tests with no data" -anchor w -variable fndat
  148.   bind .top.r3panel.fndat <Enter> { 
  149.     set helpmsg "Perform the test where one host gathers messages from many, but no actual data is sent." 
  150.     tk_butEnter %W }
  151.   checkbutton .top.r3panel.hdat -text "All head-head with data" -anchor w -variable hdat
  152.   bind .top.r3panel.hdat <Enter> { 
  153.     set helpmsg "Perform the bidirectional communication test." 
  154.     tk_butEnter %W }
  155.   checkbutton .top.r3panel.hndat -text "All head-head with no data" -anchor w -variable hndat
  156.   bind .top.r3panel.hndat <Enter> { 
  157.    set helpmsg "Perform the bidirectional communication test, but no actual data is sent." 
  158.     tk_butEnter %W }
  159.   checkbutton .top.r3panel.tdat -text "All triangle with data" -anchor w -variable tdat
  160.   bind .top.r3panel.tdat <Enter> { 
  161.     set helpmsg "Perform the test where one host sends to the next forming a loop." 
  162.     tk_butEnter %W }
  163.   checkbutton .top.r3panel.tndat -text "All triangle with no data" -anchor w -variable tndat
  164.   bind .top.r3panel.tndat <Enter> { 
  165.     set helpmsg "Perform the test where one host sends to the next forming a loop, but no actual data is sent." 
  166.     tk_butEnter %W }
  167.   checkbutton .top.r3panel.bw -text "Bandwidth and latency tests" -anchor w -variable bw
  168.   bind .top.r3panel.bw <Enter> { 
  169.     set helpmsg "Plot a graph of latency vs. message size between the first *two* hosts." 
  170.     tk_butEnter %W }
  171.  
  172.   button .top.r3panel.onetest -text "Select one test..." -bd 3 -command { OneTest }
  173.   bind .top.r3panel.onetest <Enter> { 
  174.     set helpmsg "Pick a singular test from the complete list." 
  175.     tk_butEnter %W }
  176.  
  177.   pack .top.r3panel.alltests .top.r3panel.allmsg .top.r3panel.allrtin .top.r3panel.fdat .top.r3panel.fndat \
  178.        .top.r3panel.hdat .top.r3panel.hndat .top.r3panel.tdat .top.r3panel.tndat .top.r3panel.bw \
  179.        .top.r3panel.onetest  -side top -fill both -expand true -padx 3 
  180.  
  181.   bind .top.r3panel.alltests <ButtonRelease-1> {
  182.        tk_butUp %W
  183.        if { $alltests != 0 } {
  184.      .top.r3panel.allmsg deselect
  185.      .top.r3panel.allrtin deselect
  186.          .top.r3panel.fdat deselect
  187.          .top.r3panel.fndat deselect
  188.          .top.r3panel.hdat deselect
  189.          .top.r3panel.hndat deselect
  190.          .top.r3panel.tdat deselect
  191.          .top.r3panel.tndat deselect
  192.          .top.r3panel.bw deselect
  193.      .top.r3panel.allmsg configure -state disabled
  194.      .top.r3panel.allrtin configure -state disabled
  195.          .top.r3panel.fdat configure -state disabled
  196.          .top.r3panel.fndat configure -state disabled
  197.          .top.r3panel.hdat configure -state disabled
  198.          .top.r3panel.hndat configure -state disabled
  199.          .top.r3panel.tdat configure -state disabled
  200.          .top.r3panel.tndat configure -state disabled
  201.          .top.r3panel.bw configure -state disabled 
  202.        } else {
  203.           .top.r3panel.allmsg configure -state normal
  204.      .top.r3panel.allrtin configure -state normal
  205.          .top.r3panel.fdat configure -state normal
  206.          .top.r3panel.fndat configure -state normal
  207.          .top.r3panel.hdat configure -state normal
  208.          .top.r3panel.hndat configure -state normal
  209.          .top.r3panel.tdat configure -state normal
  210.          .top.r3panel.tndat configure -state normal
  211.          .top.r3panel.bw configure -state normal } }
  212.    bind .top.r3panel.allmsg <ButtonRelease-1> {
  213.     tk_butUp %W
  214.     if { $allmsg != 0 } {
  215.          .top.r3panel.fdat deselect
  216.          .top.r3panel.fndat deselect
  217.          .top.r3panel.hdat deselect
  218.          .top.r3panel.hndat deselect
  219.          .top.r3panel.tdat deselect
  220.          .top.r3panel.tndat deselect
  221.          .top.r3panel.fdat configure -state disabled
  222.          .top.r3panel.fndat configure -state disabled
  223.          .top.r3panel.hdat configure -state disabled
  224.          .top.r3panel.hndat configure -state disabled
  225.          .top.r3panel.tdat configure -state disabled
  226.          .top.r3panel.tndat configure -state disabled
  227.        } else {
  228.          .top.r3panel.fdat configure -state normal
  229.          .top.r3panel.fndat configure -state normal
  230.          .top.r3panel.hdat configure -state normal
  231.          .top.r3panel.hndat configure -state normal
  232.          .top.r3panel.tdat configure -state normal
  233.          .top.r3panel.tndat configure -state normal } }
  234.    bind .top.r3panel.allrtin <ButtonRelease-1> {
  235.         tk_butUp %W
  236.     if { $allrtin != 0 } {
  237.       .top.r3panel.bw deselect 
  238.       .top.r3panel.bw configure -state disabled 
  239.         } else {
  240.       .top.r3panel.bw configure -state normal } }
  241. }
  242.  
  243. proc RunSel { } {
  244. global pvm_hostfile pvm_test_gui_pid
  245.  
  246.   StoreHostFileInBuffer
  247.   if {[HasATestSelected]} {
  248.     if {[CheckHostFileBuffer]} {
  249.       MakeInFile /tmp/ptg.infile.$pvm_test_gui_pid /tmp/ptg.rpt.$pvm_test_gui_pid
  250.       RunTester
  251.     } else {
  252.       error "You must have a valid PVM hostfile to run the tests." }
  253.   } 
  254. }
  255.  
  256. proc OneTest { } {
  257.   global hostfile_buffer onelabeltest
  258.  
  259.   set onelabeltest ""
  260.   .top.r3panel.alltests deselect
  261.   .top.r3panel.allmsg deselect
  262.   .top.r3panel.allrtin deselect
  263.   .top.r3panel.fdat deselect
  264.   .top.r3panel.fndat deselect
  265.   .top.r3panel.hdat deselect
  266.   .top.r3panel.hndat deselect
  267.   .top.r3panel.tdat deselect
  268.   .top.r3panel.tndat deselect
  269.   .top.r3panel.bw deselect
  270.   .top.r3panel.onetest configure -state disabled
  271.   .top.r3panel.alltests configure -state disabled
  272.   .top.r3panel.allmsg configure -state disabled
  273.   .top.r3panel.allrtin configure -state disabled
  274.   .top.r3panel.fdat configure -state disabled
  275.   .top.r3panel.fndat configure -state disabled
  276.   .top.r3panel.hdat configure -state disabled
  277.   .top.r3panel.hndat configure -state disabled
  278.   .top.r3panel.tdat configure -state disabled
  279.   .top.r3panel.tndat configure -state disabled
  280.   .top.r3panel.bw configure -state disabled
  281.   .top.menu_bar.file configure -state disabled
  282.   .top.menu_bar.output configure -state disabled
  283.  
  284.   StoreHostFileInBuffer
  285.   destroy .generic
  286.   PutGeneric .generic
  287.   bind .generic <Enter> { 
  288.     set helpmsg "Pick a singular test from the complete list." }
  289.  
  290.   frame .generic.file -bd 3 -relief ridge 
  291.   frame .generic.bframe -bd 3 -relief ridge 
  292.   frame .generic.file.sframe -relief ridge
  293.   scrollbar .generic.file.sframe.r3panelscroll -command ".generic.file.sframe.r3paneltests yview"
  294.   listbox .generic.file.sframe.r3paneltests -font 7x14 -relief sunken -yscrollcommand ".generic.file.sframe.r3panelscroll set"
  295.   button .generic.bframe.cancel -text cancel -relief raised -padx 10 -command {
  296.     .top.r3panel.onetest configure -state normal
  297.     .top.r3panel.alltests configure -state normal
  298.     .top.r3panel.allmsg configure -state normal
  299.     .top.r3panel.allrtin configure -state normal
  300.     .top.r3panel.fdat configure -state normal
  301.     .top.r3panel.fndat configure -state normal
  302.     .top.r3panel.hdat configure -state normal
  303.     .top.r3panel.hndat configure -state normal
  304.     .top.r3panel.tdat configure -state normal
  305.     .top.r3panel.tndat configure -state normal
  306.     .top.r3panel.bw configure -state normal
  307.     .top.menu_bar.file configure -state normal
  308.     .top.menu_bar.output configure -state normal
  309.     PutText
  310.     .generic.frame.tframe.text insert end $hostfile_buffer
  311.     set onelabeltest "" }
  312.     
  313.   .generic.file.sframe.r3paneltests insert end "test001: Pvm_mstat() corect"
  314.   .generic.file.sframe.r3paneltests insert end "test002: pvm_mstat() incorect"
  315.   .generic.file.sframe.r3paneltests insert end "test003: pvm_addhosts() correct"                                        
  316.   .generic.file.sframe.r3paneltests insert end "test004: pvm_delhosts() incorrect"
  317.   .generic.file.sframe.r3paneltests insert end "test005: pvm_delhosts() correct"
  318.   .generic.file.sframe.r3paneltests insert end "test006: pvm_delhosts() incorrect"
  319.   .generic.file.sframe.r3paneltests insert end "test007: Race pvm_addhosts()-pvm_config()"
  320.   .generic.file.sframe.r3paneltests insert end "test008: Race pvm_delhosts()-pvm_config()"
  321.   .generic.file.sframe.r3paneltests insert end "test009: pvm_hostsync()"
  322.   .generic.file.sframe.r3paneltests insert end "test010: pvm_pstat() correct"
  323.   .generic.file.sframe.r3paneltests insert end "test011: pvm_pstat() incorrect"
  324.   .generic.file.sframe.r3paneltests insert end "test012: pvm_spawn() sequential"
  325.   .generic.file.sframe.r3paneltests insert end "test013: pvm_spawn() simultaneous"
  326.   .generic.file.sframe.r3paneltests insert end "test014: pvm_kill() correct"
  327.   .generic.file.sframe.r3paneltests insert end "test015: pvm_kill() incorrect"
  328.   .generic.file.sframe.r3paneltests insert end "test016: pvm_tidtohost()"
  329.   .generic.file.sframe.r3paneltests insert end "test017: pvm_parent()"
  330.   .generic.file.sframe.r3paneltests insert end "test018: pvm_sendsig()"
  331.   .generic.file.sframe.r3paneltests insert end "test019: pvm_task()"
  332.   .generic.file.sframe.r3paneltests insert end "test020: pvm_exit()"
  333.   .generic.file.sframe.r3paneltests insert end "test021: Are several group server started ?"
  334.   .generic.file.sframe.r3paneltests insert end "test022: pvm_joingroup() incorrect"
  335.   .generic.file.sframe.r3paneltests insert end "test023: pvm_lvgroup() incorrect"
  336.   .generic.file.sframe.r3paneltests insert end "test024: pvm_joingroup(),pvm_lvgroup(),pvm_gsize()"
  337.   .generic.file.sframe.r3paneltests insert end "test025: Group completion"
  338.   .generic.file.sframe.r3paneltests insert end "test026: pvm_getinst(),pvm_gettid()"
  339.   .generic.file.sframe.r3paneltests insert end "test027: pvm_initsend(),pvm_getsbuf(),pvm_freebuf()"
  340.   .generic.file.sframe.r3paneltests insert end "test028: pvm_pkxxx(),pvm_upkxxx()"
  341.   .generic.file.sframe.r3paneltests insert end "test029: pvm_getrbuf()"
  342.   .generic.file.sframe.r3paneltests insert end "test030: pvm_bufinfo()"
  343.   .generic.file.sframe.r3paneltests insert end "test031: pvm_mytid()"
  344.   .generic.file.sframe.r3paneltests insert end "test032: pvm_mkbuf()"
  345.   .generic.file.sframe.r3paneltests insert end "test033: pvm_(p)send()-pvm_(p)recv() coherency"
  346.   .generic.file.sframe.r3paneltests insert end "test034: pvm_setsbuf()"
  347.   .generic.file.sframe.r3paneltests insert end "test035: pvm_setrbuf()"
  348.   .generic.file.sframe.r3paneltests insert end "test036: pvm_setxbuf() incorrect"
  349.   .generic.file.sframe.r3paneltests insert end "test037: pvm_bcast()"
  350.   .generic.file.sframe.r3paneltests insert end "test038: pvm_barrier()"
  351.   .generic.file.sframe.r3paneltests insert end "test039: pvm_reduce()"
  352.   .generic.file.sframe.r3paneltests insert end "test040: pvm_gather()"
  353.   .generic.file.sframe.r3paneltests insert end "test041: pvm_scatter()"
  354.   .generic.file.sframe.r3paneltests insert end "test042: pvm_mcast()"
  355.   .generic.file.sframe.r3paneltests insert end "test043: pvm_trecv()"
  356.   .generic.file.sframe.r3paneltests insert end "test044: pvm_nrecv()"
  357.   .generic.file.sframe.r3paneltests insert end "test045: Latency-Bandwidth pvm_send()-pvm_recv()"
  358.   .generic.file.sframe.r3paneltests insert end "test046: Latency-Bandwidth pvm_psend()-pvm_precv()"
  359.   .generic.file.sframe.r3paneltests insert end "test047: pvm_notify()"
  360.   .generic.file.sframe.r3paneltests insert end "test048: head-head, PvmDataDefault, daemon routing, send, empty"
  361.   .generic.file.sframe.r3paneltests insert end "test049: head-head, PvmDataRaw, daemon routing, send, empty"
  362.   .generic.file.sframe.r3paneltests insert end "test050: head-head, PvmDataInPlace, daemon routing, send, empty"
  363.   .generic.file.sframe.r3paneltests insert end "test051: head-head, PvmDataDefault, direct routing, send, empty"
  364.   .generic.file.sframe.r3paneltests insert end "test052: head-head, PvmDataRaw, direct routing, send, empty"
  365.   .generic.file.sframe.r3paneltests insert end "test053: head-head, PvmDataInPlace, direct routing, send, empty"
  366.   .generic.file.sframe.r3paneltests insert end "test054: head-head, -, daemon routing, psend, empty"
  367.   .generic.file.sframe.r3paneltests insert end "test055: head-head, -, direct routing, psend, empty"
  368.   .generic.file.sframe.r3paneltests insert end "test056: head-head, PvmDataDefault, daemon routing, send, data"
  369.   .generic.file.sframe.r3paneltests insert end "test057: head-head, PvmDataRaw, daemon routing, send, data"
  370.   .generic.file.sframe.r3paneltests insert end "test058: head-head, PvmDataInPlace, daemon routing, send, data"
  371.   .generic.file.sframe.r3paneltests insert end "test059: head-head, PvmDataDefault, direct routing, send, data"
  372.   .generic.file.sframe.r3paneltests insert end "test060: head-head, PvmDataRaw, direct routing, send, data"
  373.   .generic.file.sframe.r3paneltests insert end "test061: head-head, PvmDataInPLace, direct routing, send, data"
  374.   .generic.file.sframe.r3paneltests insert end "test062: head-head, -, daemon routing, psend, data"
  375.   .generic.file.sframe.r3paneltests insert end "test063: head-head, -, direct routing, psend, data"
  376.   .generic.file.sframe.r3paneltests insert end "test064: triangle, PvmDataDefault, daemon routing, send, empty"
  377.   .generic.file.sframe.r3paneltests insert end "test065: triangle, PvmDataRaw, daemon routing, send, empty"
  378.   .generic.file.sframe.r3paneltests insert end "test066: triangle, PvmDataInPlace, daemon routing, send, empty"
  379.   .generic.file.sframe.r3paneltests insert end "test067: triangle, PvmDataDefault, direct routing, send, empty"
  380.   .generic.file.sframe.r3paneltests insert end "test068: triangle, PvmDataRaw, direct routing, send, empty"
  381.   .generic.file.sframe.r3paneltests insert end "test069: triangle, PvmDataInPlace, direct routing, send, empty"
  382.   .generic.file.sframe.r3paneltests insert end "test070: triangle, -, daemon routing, psend, empty"
  383.   .generic.file.sframe.r3paneltests insert end "test071: triangle, -, direct routing, psend, empty"
  384.   .generic.file.sframe.r3paneltests insert end "test072: triangle, PvmDataDefault, daemon routing, send, data"
  385.   .generic.file.sframe.r3paneltests insert end "test073: triangle, PvmDataRaw, daemon routing, send, data"
  386.   .generic.file.sframe.r3paneltests insert end "test074: triangle, PvmDataInPlace, daemon routing, send, data"
  387.   .generic.file.sframe.r3paneltests insert end "test075: triangle, PvmDataDefault, direct routing, send, data"
  388.   .generic.file.sframe.r3paneltests insert end "test076: triangle, PvmDataRaw, direct routing, send, data"
  389.   .generic.file.sframe.r3paneltests insert end "test077: triangle, PvmDataInPLace, direct routing, send, data"
  390.   .generic.file.sframe.r3paneltests insert end "test078: triangle, -, daemon routing, psend, data"
  391.   .generic.file.sframe.r3paneltests insert end "test079: triangle, -, direct routing, psend, data"
  392.   .generic.file.sframe.r3paneltests insert end "test080: funneling, PvmDataDefault, daemon routing, send, empty"
  393.   .generic.file.sframe.r3paneltests insert end "test081: funneling, PvmDataRaw, daemon routing, send, empty"
  394.   .generic.file.sframe.r3paneltests insert end "test082: funneling, PvmDataInPlace, daemon routing, send, empty"
  395.   .generic.file.sframe.r3paneltests insert end "test083: funneling, PvmDataDefault, direct routing, send, empty"
  396.   .generic.file.sframe.r3paneltests insert end "test084: funneling, PvmDataRaw, direct routing, send, empty"
  397.   .generic.file.sframe.r3paneltests insert end "test085: funneling, PvmDataInPlace, direct routing, send, empty"
  398.   .generic.file.sframe.r3paneltests insert end "test086: funneling, PvmDataDefault, daemon routing, mcast, empty"
  399.   .generic.file.sframe.r3paneltests insert end "test087: funneling, PvmDataRaw, daemon routing, mcast, empty"
  400.   .generic.file.sframe.r3paneltests insert end "test088: funneling, PvmDataInPlace, daemon routing, mcast, empty"
  401.   .generic.file.sframe.r3paneltests insert end "test089: funneling, PvmDataDefault, direct routing, mcast, empty"
  402.   .generic.file.sframe.r3paneltests insert end "test090: funneling, PvmDataRaw, direct routing, mcast, empty"
  403.   .generic.file.sframe.r3paneltests insert end "test091: funneling, PvmDataInPlace, direct routing, mcast, empty"
  404.   .generic.file.sframe.r3paneltests insert end "test092: funneling, -, daemon routing, psend, empty"
  405.   .generic.file.sframe.r3paneltests insert end "test093: funneling, -, direct routing, psend, empty"
  406.   .generic.file.sframe.r3paneltests insert end "test094: funneling, PvmDataDefault, daemon routing, send, data"
  407.   .generic.file.sframe.r3paneltests insert end "test095: funneling, PvmDataRaw, daemon routing, send, data"
  408.   .generic.file.sframe.r3paneltests insert end "test096: funneling, PvmDataInPlace, daemon routing, send, data"
  409.   .generic.file.sframe.r3paneltests insert end "test097: funneling, PvmDataDefault, direct routing, send, data"
  410.   .generic.file.sframe.r3paneltests insert end "test098: funneling, PvmDataRaw, direct routing, send, data"
  411.   .generic.file.sframe.r3paneltests insert end "test099: funneling, PvmDataInPlace, direct routing, send, data"
  412.   .generic.file.sframe.r3paneltests insert end "test100: funneling, PvmDataDefault, daemon routing, mcast, data"
  413.   .generic.file.sframe.r3paneltests insert end "test101: funneling, PvmDataRaw, daemon routing, mcast, data"
  414.   .generic.file.sframe.r3paneltests insert end "test102: funneling, PvmDataInPlace, daemon routing, mcast, data"
  415.   .generic.file.sframe.r3paneltests insert end "test103: funneling, PvmDataDefault, direct routing, mcast, data"
  416.   .generic.file.sframe.r3paneltests insert end "test104: funneling, PvmDataRaw, direct routing, mcast, data"
  417.   .generic.file.sframe.r3paneltests insert end "test105: funneling, PvmDataInPlace, direct routing, mcast, data"
  418.   .generic.file.sframe.r3paneltests insert end "test106: funneling, -, daemon routing, psend, data"
  419.   .generic.file.sframe.r3paneltests insert end "test107: funneling, -, direct routing, psend, data"
  420.  
  421.   pack .generic.file -padx 5 -pady 5 -side left -anchor nw -expand true -fill both 
  422.   pack .generic.bframe -padx 5 -pady 5 -side right -fill x 
  423.   pack .generic.file.sframe -side top -expand true -fill both
  424.   pack .generic.file.sframe.r3panelscroll -side right -fill y
  425.   pack .generic.file.sframe.r3paneltests -side left -fill both -expand true
  426.   pack .generic.bframe.cancel -fill x -ipady 10
  427.  
  428.   tk_listboxSingleSelect .generic.file.sframe.r3paneltests
  429.   bind .generic.file.sframe.r3paneltests  <Button-1> {
  430.     %W select from [%W nearest %y]
  431.     set onelabeltest [string range [%W get [%W nearest %y]] 0 6] }
  432. }
  433.  
  434. proc fileselect.ok.cmd {w cmd} {
  435.     global fileselect
  436.  
  437.     set selected [$fileselect(entry) get]
  438.     set trimmed [string trim $selected]
  439.  
  440.     if {[string length $trimmed] == 0} {
  441.         return }
  442.  
  443.     if {[file isdirectory $trimmed] != 0} {
  444.         # clean the text entry and prepare the list
  445.     $fileselect(entry) delete 0 end
  446.     $fileselect(list) delete 0 end
  447.     cd $trimmed
  448.     set dir [pwd]
  449.     $fileselect(dirlabel) configure -text $dir
  450.     foreach i [exec /bin/ls -a $dir] {
  451.       if {[file isdirectory $i]} {
  452.         $fileselect(list) insert end $i/
  453.       } else {  
  454.         $fileselect(list) insert end $i }
  455.     }
  456.     return }
  457.  
  458.     set path [pwd]
  459.     $cmd $trimmed $path
  460. }
  461.  
  462. proc fileselect.cancel.cmd {w {cmd ""}} {
  463.     if {$cmd != ""} {
  464.       $cmd 
  465.     } else {
  466.       destroy $w
  467.       PutGeneric .generic }
  468. }
  469.  
  470. proc file_window {w cmd cancel} {
  471.     destroy $w
  472.     PutGeneric $w
  473.     real_file_window "Filename:" $w $cmd $cancel }
  474.  
  475. proc real_file_window {heading w cmd cancel} {
  476.     label $w.dirlabel -anchor sw -relief ridge -bd 3 -text [pwd] 
  477.     pack $w.dirlabel -side bottom -anchor sw -fill x -padx 5 -pady 5 
  478.  
  479.     frame $w.file -bd 3 -relief ridge 
  480.     pack $w.file -padx 5 -pady 5 -side left -anchor nw -expand true -fill both 
  481.  
  482.     frame $w.bframe -bd 3 -relief ridge 
  483.     pack $w.bframe -padx 5 -pady 5 -side right -fill x 
  484.  
  485.     frame $w.file.eframe -relief ridge
  486.     pack $w.file.eframe -side top -fill both -anchor nw 
  487.  
  488.     frame $w.file.sframe -relief ridge
  489.     pack $w.file.sframe -side top -expand true -fill both
  490.  
  491.     label $w.file.eframe.label1 -text "$heading"
  492.     entry $w.file.eframe.entry -relief sunken
  493.     pack $w.file.eframe.label1 $w.file.eframe.entry -side top -fill x
  494.  
  495.     scrollbar $w.file.sframe.yscroll -relief sunken -command "$w.file.sframe.list yview"
  496.     pack $w.file.sframe.yscroll -side right -fill y
  497.  
  498.     listbox $w.file.sframe.list -relief sunken \
  499.     -yscroll "$w.file.sframe.yscroll set" 
  500.     pack $w.file.sframe.list -side left -expand true -fill both
  501.  
  502.     button $w.bframe.ok -text OK -bd 5 -relief raised -padx 10 \
  503.         -command "fileselect.ok.cmd $w $cmd"
  504.     button $w.bframe.cancel -text cancel -relief raised -padx 10 \
  505.         -command "fileselect.cancel.cmd $w $cancel"
  506.     pack $w.bframe.ok $w.bframe.cancel -fill x -ipady 10
  507.  
  508.     # path independent names for the widgets
  509.     global fileselect
  510.  
  511.     set fileselect(entry) $w.file.eframe.entry
  512.     set fileselect(list) $w.file.sframe.list
  513.     set fileselect(scroll) $w.file.sframe.scroll
  514.     set fileselect(ok) $w.bframe.ok
  515.     set fileselect(cancel) $w.bframe.cancel
  516.     set fileselect(dirlabel) $w.dirlabel
  517.  
  518.     # Fill the listbox with a list of the files in the directory (run
  519.     # the "/bin/ls" command to get that information).
  520.  
  521.     foreach i [exec /bin/ls -a [pwd]] {
  522.       if {[file isdirectory $i]} {
  523.     $w.file.sframe.list insert end $i/
  524.       } else {  
  525.     $w.file.sframe.list insert end $i }
  526.     }
  527.  
  528.     # Set up bindings for the window
  529.     bind $w <Return> {eval $fileselect(ok) invoke}
  530.     bind $w <Control-c> {eval $fileselect(cancel) invoke}
  531.  
  532.     # Set up bindings for the entry field.
  533.     bind $fileselect(entry) <Return> {eval $fileselect(ok) invoke}
  534.     bind $fileselect(entry) <Control-c> {eval $fileselect(cancel) invoke}
  535.  
  536.     tk_listboxSingleSelect $fileselect(list)
  537.  
  538.     bind $fileselect(list) <Button-1> {
  539.         # puts stderr "button 1 release"
  540.         %W select from [%W nearest %y]
  541.     $fileselect(entry) delete 0 end
  542.     $fileselect(entry) insert 0 [%W get [%W nearest %y]]
  543.     }
  544.  
  545.     bind $fileselect(list) <Key> {
  546.         %W select from [%W nearest %y]
  547.         $fileselect(entry) delete 0 end
  548.     $fileselect(entry) insert 0 [%W get [%W nearest %y]]
  549.     }
  550.  
  551.     bind $fileselect(list) <Double-ButtonPress-1> {
  552.         # puts stderr "double button 1"
  553.         %W select from [%W nearest %y]
  554.     $fileselect(entry) delete 0 end
  555.     $fileselect(entry) insert 0 [%W get [%W nearest %y]]
  556.     $fileselect(ok) invoke
  557.     }
  558.  
  559.     bind $fileselect(list) <Return> {
  560.         %W select from [%W nearest %y]
  561.     $fileselect(entry) delete 0 end
  562.     $fileselect(entry) insert 0 [%W get [%W nearest %y]]
  563.     $fileselect(ok) invoke
  564.     }
  565.  
  566.     # set kbd focus to entry widget
  567.  
  568.     focus $fileselect(entry)
  569. }
  570.  
  571. proc PutGeneric { name } {
  572.   frame $name -relief raised -bd 2 
  573.   pack $name -side bottom -anchor sw -fill both
  574. }
  575.  
  576. #
  577. # Post the results window.
  578. #
  579.  
  580. proc PutResults { } {
  581.   global pvm_test_gui_pid
  582.   toplevel .results
  583.   wm maxsize .results 1000 500
  584.   wm minsize .results 250 125
  585.  
  586.   grab set .results
  587.  
  588.   frame .results.top 
  589.   pack .results.top -side top -fill both -expand true
  590.  
  591.   frame .results.top.sframe 
  592.   pack .results.top.sframe -side left -fill both -expand true
  593.  
  594.   frame .results.top.bframe -relief ridge -bd 3 
  595.   pack .results.top.bframe -side right
  596.   button .results.top.bframe.save -text Save -command { SaveResults }
  597.   button .results.top.bframe.done -text Done -command { DoneResults }
  598. #  button .results.top.bframe.save_graph -text "Save Graph" -command { SaveGraph } -state disabled
  599. #  pack .results.top.bframe.save .results.top.bframe.done .results.top.bframe.save_graph -side top -fill both
  600.   pack .results.top.bframe.save .results.top.bframe.done -side top -fill both
  601.  
  602.   frame .results.top.sframe.right 
  603.   label .results.top.sframe.right.l2 -text "Summary"
  604.   pack .results.top.sframe.right -side right -expand true -fill both -padx 5
  605.   pack .results.top.sframe.right.l2 -side top
  606.  
  607.   listbox .results.top.sframe.right.outcome -bd 2 -relief sunken \
  608.     -yscrollcommand ".results.top.sframe.right.yscroll set" \
  609.     -xscrollcommand ".results.top.sframe.right.xscroll set" 
  610.   scrollbar .results.top.sframe.right.yscroll -command ".results.top.sframe.right.outcome yview" 
  611.   scrollbar .results.top.sframe.right.xscroll -orient horizontal -command ".results.top.sframe.right.outcome xview" 
  612.   pack .results.top.sframe.right.yscroll -side right -fill y 
  613.   pack .results.top.sframe.right.xscroll -side bottom -fill x 
  614.   pack .results.top.sframe.right.outcome -side right -expand true -fill both 
  615.   tk_listboxSingleSelect .results.top.sframe.right.outcome 
  616.  
  617.   frame .results.top.sframe.left 
  618.   label .results.top.sframe.left.l1 -text "Data (Click on a test to view)"
  619.   pack .results.top.sframe.left -side left -expand true -fill both
  620.   pack .results.top.sframe.left.l1 -side top
  621.  
  622.   text .results.top.sframe.left.info -bd 2 -relief sunken -yscrollcommand ".results.top.sframe.left.yscroll set" -wrap word
  623.   scrollbar .results.top.sframe.left.yscroll -command ".results.top.sframe.left.info yview" 
  624.   pack .results.top.sframe.left.info -side left -fill both
  625.   pack .results.top.sframe.left.yscroll -side left -fill y 
  626.  
  627.   .results.top.sframe.right.outcome insert end "Report header"
  628.   set fd [open /tmp/ptg.rpt.$pvm_test_gui_pid r]
  629.   while {[gets $fd line] >= 0} {
  630.     if {[string match test#*:* $line] == 1} {
  631.       set name [string trim [string range $line 0 [expr [string first ":" $line]-1]]]
  632.       gets $fd line
  633.       while {[string match test#*:* $line] != 1} {
  634.         gets $fd line}
  635.       set result [string trim [string range $line [expr [string last ":" $line]+2] end]]
  636.       if { $name == "test#45" } {
  637.         set name "send :latency-bandwidth 1" }
  638.        if { $name == "test#46" } {
  639.         set name "psend :latency-bandwidth 2" }
  640.       .results.top.sframe.right.outcome insert end "$name: $result"
  641.     } elseif {[lrange $line 2 3] == "time totals"} {
  642.       .results.top.sframe.right.outcome insert end "[lrange $line 0 0] timings"
  643.     } } 
  644.   close $fd
  645.  
  646.   bind .results.top.sframe.right.outcome <Button-1> {
  647.     set cmp [string range [.results.top.sframe.right.outcome get [.results.top.sframe.right.outcome nearest %y]] 0 7]
  648.     if { $cmp == "send :la" } { 
  649.       FindAndInsertInformation "test#45:"
  650.     } elseif { $cmp == "psend :l"} {
  651.     FindAndInsertInformation "test#46:"
  652.     } elseif { $cmp == "Report h" } {
  653.       FindAndInsertInformation "--------"
  654.     } else {
  655.       FindAndInsertInformation $cmp } }
  656. }
  657.  
  658. proc InsertBlockOfInformation { fd } {
  659.   while {[gets $fd line] >= 0} {
  660.     set begline [string range $line 0 3]
  661.     if {$begline=="test"||$begline=="funn"||$begline=="head"||$begline=="tria"} {
  662.       return 
  663.     } else {
  664.       .results.top.sframe.left.info insert end "$line\n" }
  665.   }
  666. }
  667.  
  668. proc FindAndInsertInformation { first_eight_chars } {
  669. global pvm_test_gui_pid
  670.  
  671.   set fd [open /tmp/ptg.rpt.$pvm_test_gui_pid r]
  672.   while {[gets $fd line] >= 0} {
  673.     if {[string match $first_eight_chars* $line] == 1} {
  674.       .results.top.sframe.left.info delete 1.0 end
  675.       .results.top.sframe.left.info insert end "$line\n"    
  676.       InsertBlockOfInformation $fd
  677.       close $fd
  678.       return 
  679.     } }
  680.   return 
  681. }
  682.  
  683. #
  684. # Finished dealing with the results window.
  685. #
  686.  
  687. proc DoneResults { } {
  688.   destroy .results
  689.   grab set .generic
  690. }
  691.  
  692. #
  693. # Finished dealing with the results for good.
  694. #
  695.  
  696. proc DoneResultsForGood { } {
  697.   global pvm_test_gui_pid pvm_test_pid
  698.   exec rm -f /tmp/ptg.rpt.$pvm_test_gui_pid /tmp/ptg.status.$pvm_test_gui_pid /tmp/ptg.hosts.$pvm_test_gui_pid 
  699.   OpenClickedCancel
  700. }
  701.  
  702. #
  703. # Save the report file generated by pvm_test.
  704. #
  705.  
  706. proc SaveResults { } {
  707.   .results.top.bframe.save configure -state disabled
  708.   frame .results.bottom 
  709.   pack .results.bottom -side bottom -expand true -fill both
  710.   frame .results.bottom.fframe 
  711.   pack .results.bottom.fframe -side bottom -expand true -fill both
  712.   grab .results.bottom.fframe
  713.   real_file_window "Filename for report:" .results.bottom.fframe SaveResultsOK SaveResultsCancel
  714. }
  715. proc SaveResultsOK { name path } {
  716.   global pvm_test_gui_pid
  717.   if {[string index [string trim $name] 0] == "/"} {
  718.     set outname "$name"
  719.   } else {
  720.     set outname "$path/$name"    
  721.   }
  722.   exec cp /tmp/ptg.rpt.$pvm_test_gui_pid $outname
  723.   destroy .results.bottom
  724.   .results.top.bframe.save configure -state normal
  725. }
  726. proc SaveResultsCancel { } {
  727.   destroy .results.bottom
  728.   .results.top.bframe.save configure -state normal }
  729.  
  730. #
  731. # Save the postscript file generated by GNUPLOT
  732. #
  733.  
  734. proc SaveGraph { } {
  735.   .results.top.bframe.save_graph configure -state disabled
  736.   frame .results.bottom2 
  737.   pack .results.bottom2 -side bottom -expand true -fill both
  738.   frame .results.bottom2.fframe 
  739.   pack .results.bottom2.fframe -side bottom -expand true -fill both
  740.   grab .results.bottom2.fframe
  741.   real_file_window "Filename for PS graph:" .results.bottom2.fframe SaveGraphOK SaveGraphCancel
  742. }
  743. proc SaveGraphOK { name path } {
  744.   global pvm_test_gui_pid
  745.   if {[string index [string trim $name] 0] == "/"} {
  746.     set outname "$name"
  747.   } else {
  748.     set outname "$path/$name"    
  749.   }
  750.   exec cp "/tmp/ptg.ps.$pvm_test_gui_pid" $outname
  751.   destroy .results.bottom2
  752.   .results.top.bframe.save_graph configure -state normal
  753. }
  754. proc SaveGraphCancel { } {
  755.   destroy .results.bottom2
  756.   .results.top.bframe.save_graph configure -state normal }
  757.  
  758. proc PutMenus { } {
  759.   frame .top.menu_bar -relief raised -bd 2
  760.   bind .top.menu_bar <Enter> { 
  761.     set helpmsg "These menus deal with the input to pvm_test and the PVM host file shown below." }
  762.  
  763.   menubutton .top.menu_bar.file -text "Hosts" -menu .top.menu_bar.file.e
  764.   menu .top.menu_bar.file.e
  765.   .top.menu_bar.file.e add command -label "Open..." -command { Open } 
  766.   .top.menu_bar.file.e add command -label "Save" -command { Save  } 
  767.   .top.menu_bar.file.e add command -label "Save As..." -command { SaveAs } 
  768.   .top.menu_bar.file.e add command -label "Exit" -command { Exit }
  769.  
  770.   menubutton .top.menu_bar.output -text "Input" -menu .top.menu_bar.output.e
  771.   menu .top.menu_bar.output.e
  772.   .top.menu_bar.output.e add command -label "Save As..." -command { ConfigSaveAs } 
  773.  
  774.   pack .top.menu_bar -fill x -side top
  775.   pack .top.menu_bar.file .top.menu_bar.output -side left 
  776. }
  777.  
  778. proc PutHelp { } {
  779.   label .top.help -font "-*-helvetica-medium-r-normal-*-10-*-*-*-p-*-iso8859-1" -textvariable helpmsg -relief ridge -bd 2
  780.   bind .top.help <Enter> { 
  781.     set helpmsg "This panel displays helpful text about the object you're pointing to." }
  782.   pack .top.help -side top -fill both -expand true -padx 5 -pady 2
  783. }
  784.  
  785. proc PutSliders { } {
  786.   global num_procs siz_mesgs num_mesgs bw_start bw_end bw_inc
  787.  
  788.   frame .top.r1panel 
  789.   pack .top.r1panel -pady 2 -padx 2 -side right -anchor ne -expand true -fill both
  790.  
  791.   label .top.r1panel.l1 -text "Messaging tests parameters:" 
  792.   scale .top.r1panel.s1 -label "Number of processes" -from 1 -to 128 -length 150 -orient horizontal -command DoSliders
  793.   .top.r1panel.s1 set $num_procs
  794.   scale .top.r1panel.s2 -label "Units per message" -from 1 -to 4096 -length 150 -orient horizontal -command DoSliders
  795.   .top.r1panel.s2 set $siz_mesgs
  796.   scale .top.r1panel.s3 -label "Messages per test" -from 1 -to 256 -length 150 -orient horizontal -command DoSliders
  797.   .top.r1panel.s3 set $num_mesgs
  798.   pack .top.r1panel.l1 .top.r1panel.s1 .top.r1panel.s2 .top.r1panel.s3 -side top -fill both -expand true
  799.  
  800.   bind .top.r1panel.s1 <Enter> { 
  801.     set helpmsg "The number of slave processes spawned for the funneling tests." }
  802.   bind .top.r1panel.s2 <Enter> { 
  803.     set helpmsg "The number of units in each message, each unit has one member of each data type." }
  804.   bind .top.r1panel.s3 <Enter> { 
  805.     set helpmsg "The number of times to send the message per process." }
  806.   bind .top.r1panel.s1 <Button-2> {
  807.     set tmp [.top.r1panel.s1 get]
  808.     .top.r1panel.s1 set [expr $tmp-1] }
  809.   bind .top.r1panel.s2 <Button-2> {
  810.     set tmp [.top.r1panel.s2 get]
  811.     .top.r1panel.s2 set [expr $tmp-1] }
  812.   bind .top.r1panel.s3 <Button-2> {
  813.     set tmp [.top.r1panel.s3 get]
  814.     .top.r1panel.s3 set [expr $tmp-1] }
  815.   bind .top.r1panel.s1 <Button-3> {
  816.     set tmp [.top.r1panel.s1 get]
  817.     .top.r1panel.s1 set [expr $tmp+1] }
  818.   bind .top.r1panel.s2 <Button-3> {
  819.     set tmp [.top.r1panel.s2 get]
  820.     .top.r1panel.s2 set [expr $tmp+1] }
  821.   bind .top.r1panel.s3 <Button-3> {
  822.     set tmp [.top.r1panel.s3 get]
  823.     .top.r1panel.s3 set [expr $tmp+1] }
  824.  
  825.   label .top.r1panel.l2 -text "Bandwidth parameters: (bytes)" 
  826.   scale .top.r1panel.s4 -label "Start" -from 0 -to 10000 -length 150 -orient horizontal -command DoSliders
  827.   .top.r1panel.s4 set $bw_start
  828.   scale .top.r1panel.s5 -label "End" -from 1 -to 10000 -length 150 -orient horizontal -command DoSliders
  829.   .top.r1panel.s5 set $bw_end
  830.   scale .top.r1panel.s6 -label "Increment" -from 1 -to 1024 -length 150 -orient horizontal -command DoSliders
  831.   .top.r1panel.s6 set $bw_inc
  832.   pack .top.r1panel.s5 .top.r1panel.s6 .top.r1panel.s4 .top.r1panel.l2 -side bottom -fill both -expand true
  833.  
  834.   bind .top.r1panel.s4 <Enter> { 
  835.     set helpmsg "The starting size of the message to send in the bandwidth test." }
  836.   bind .top.r1panel.s5 <Enter> { 
  837.     set helpmsg "The Maximum size of message to send in the bandwidth test." }
  838.   bind .top.r1panel.s6 <Enter> { 
  839.     set helpmsg "The size increase the message by on each iteration." }
  840.   bind .top.r1panel.s4 <Button-2> {
  841.     set tmp [.top.r1panel.s4 get]
  842.     .top.r1panel.s4 set [expr $tmp-1] }
  843.   bind .top.r1panel.s5 <Button-2> {
  844.     set tmp [.top.r1panel.s5 get]
  845.     .top.r1panel.s5 set [expr $tmp-1] }
  846.   bind .top.r1panel.s6 <Button-2> {
  847.     set tmp [.top.r1panel.s6 get]
  848.     .top.r1panel.s6 set [expr $tmp-1] }
  849.   bind .top.r1panel.s4 <Button-3> {
  850.     set tmp [.top.r1panel.s4 get]
  851.     .top.r1panel.s4 set [expr $tmp+1] }
  852.   bind .top.r1panel.s5 <Button-3> {
  853.     set tmp [.top.r1panel.s5 get]
  854.     .top.r1panel.s5 set [expr $tmp+1] }
  855.   bind .top.r1panel.s6 <Button-3> {
  856.     set tmp [.top.r1panel.s6 get]
  857.     .top.r1panel.s6 set [expr $tmp+1] }
  858. }
  859.  
  860. proc PutCheckButtons { } {
  861.   global atime_bool ttime_bool all_comb_bool
  862.  
  863.   label .top.r1panel.l3 -text "General options:" 
  864.   label .top.r1panel.l4 -text "Timing options:"
  865.   checkbutton .top.r1panel.r2 -text "Average Time" -variable atime_bool -anchor w 
  866.   checkbutton .top.r1panel.r3 -text "Total Time" -variable ttime_bool -anchor w
  867.   checkbutton .top.r1panel.r1 -text "All Combinations" -variable all_comb_bool -anchor w 
  868.   pack .top.r1panel -pady 2 -padx 2 -side right -anchor ne -expand true -fill both
  869.   pack .top.r1panel.l3 -fill both -expand true -side top
  870.   pack .top.r1panel.r2 .top.r1panel.r3 -fill both -expand true -side bottom
  871.   pack .top.r1panel.l4 -fill both -expand true -side bottom
  872.   pack .top.r1panel.r1 -fill both -expand true -side bottom
  873.  
  874.   bind .top.r1panel.r1 <Enter> {
  875.     set helpmsg "Try all architectures combination ?"
  876.     tk_butEnter %W }
  877.   bind .top.r1panel.r2 <Enter> { 
  878.     set helpmsg "Display the amount of time each process took per message"
  879.     tk_butEnter %W }
  880.   bind .top.r1panel.r3 <Enter> { 
  881.     set helpmsg "Display the amount of time each process took to send all the messages"
  882.     tk_butEnter %W }
  883. }
  884.  
  885. proc PutActionButtons { } {
  886.   MakeSel
  887. }
  888.  
  889. proc AddHostToList { } {
  890.   global HostList
  891.   set host [.generic.frame.eframe.entry1 get]
  892.   set path [.generic.frame.eframe.entry2 get]
  893.   if {($host != "") && ($path != "")} {
  894.     if {[lsearch $HostList "$host*"] == -1} {
  895.       set entry "$host $path"
  896.       lappend HostList $entry
  897.       set HostList [lsort $HostList]
  898.       .generic.frame.names delete 0 end
  899.       foreach name $HostList {
  900.         .generic.frame.names insert end "$name" }
  901.     }
  902.   } 
  903. }
  904.  
  905. proc RemHostFromList { } {
  906.   global HostList
  907.   if {[selection own] != ""} {
  908.     foreach host [selection get] {
  909.       set index [lsearch $HostList $host]
  910.       set HostList [lreplace $HostList $index $index]
  911.       .modhost.frame.names delete $index $index } }
  912. }
  913.  
  914. proc DoSliders value {
  915.   global num_procs siz_mesgs num_mesgs bw_start bw_end bw_inc
  916.   set num_procs [.top.r1panel.s1 get]
  917.   set siz_mesgs [.top.r1panel.s2 get]
  918.   set num_mesgs [.top.r1panel.s3 get]
  919.   set bw_start [.top.r1panel.s4 get]
  920.   set bw_inc [.top.r1panel.s6 get]
  921.   set bw_end [.top.r1panel.s5 get]
  922. }
  923.  
  924. proc PutText { } {
  925.   destroy .generic
  926.   PutGeneric .generic
  927.  
  928.   frame .generic.frame -relief ridge 
  929.   pack .generic.frame -side left -anchor nw -expand true -fill both
  930.  
  931.   frame .generic.frame.tframe -relief ridge
  932.   pack .generic.frame.tframe -side left -fill both -anchor nw
  933.  
  934.   frame .generic.frame.sframe -relief ridge 
  935.   pack .generic.frame.sframe -side right -fill both 
  936.  
  937.   scrollbar .generic.frame.sframe.scrollbar -relief sunken -command ".generic.frame.tframe.text yview"
  938.   pack .generic.frame.sframe.scrollbar -side right -fill y
  939.  
  940.   text .generic.frame.tframe.text -height 10 -yscrollcommand ".generic.frame.sframe.scrollbar set"
  941.   pack .generic.frame.tframe.text -side left -fill both
  942.  
  943.   bind .generic.frame.tframe.text <Up> {
  944.     .generic.frame.tframe.text mark set "insert" "insert - 1 lines" 
  945.     .generic.frame.tframe.text yview -pickplace "insert" }
  946.   bind .generic.frame.tframe.text <Down> {
  947.     .generic.frame.tframe.text mark set "insert" "insert + 1 lines"
  948.     .generic.frame.tframe.text yview -pickplace "insert" }
  949.   bind .generic.frame.tframe.text <Shift-Up> {
  950.     .generic.frame.tframe.text mark set "insert" "0.0" 
  951.     .generic.frame.tframe.text yview -pickplace "insert" }
  952.   bind .generic.frame.tframe.text <Shift-Down> {
  953.     .generic.frame.tframe.text mark set "insert" "end"
  954.     .generic.frame.tframe.text yview -pickplace "insert" }
  955.   bind .generic.frame.tframe.text <Left> {
  956.     .generic.frame.tframe.text mark set "insert" "insert - 1 chars" }
  957.   bind .generic.frame.tframe.text <Right> {
  958.     .generic.frame.tframe.text mark set "insert" "insert + 1 chars" }
  959.   bind .generic.frame.tframe.text <Enter> {
  960.     set helpmsg "Click here and enter the names and PVM options of the hosts you wish to test, one host per line." }
  961. }
  962.  
  963. proc HasATestSelected { } {
  964.   global onelabeltest alltests allmsg allrtin fdat fndat hdat hndat tdat tndat bw
  965.   if { $onelabeltest != "" || $alltests || $allmsg || $allrtin || $fdat || $fndat || $hdat || $hndat || $tdat || $tndat || $bw } {
  966.     return 1 
  967.   } else {
  968.     return 0 }
  969. }
  970.  
  971. proc CheckHostFileBuffer { } {
  972.   global hostfile_buffer
  973.  
  974.   if {[string trim $hostfile_buffer] == ""} {
  975.     return 0 
  976.   } else {   
  977.     return 1 } 
  978. }
  979.  
  980. proc StoreHostFileInBuffer { } {
  981.   global hostfile_buffer
  982.  
  983.   if {[catch {.generic.frame.tframe.text get 1.0 end}] == 0} {
  984.     set hostfile_buffer [.generic.frame.tframe.text get 1.0 end] }
  985. }
  986.  
  987. proc ConfigSaveAs { } {
  988.  
  989.   StoreHostFileInBuffer
  990.   if {[HasATestSelected]} {
  991.     if {[CheckHostFileBuffer]} {
  992.       file_window .generic ConfigSaveAsClickedOk SaveAsClickedCancel
  993.     } else {
  994.       error "You must have a valid PVM hostfile to generate the pvm_test input file." }
  995.   } else {
  996.     error "You must select some tests to perform."
  997.   } 
  998. }
  999.  
  1000. proc ConfigSaveAsClickedOk {name path} {
  1001.   if {$path != ""} {
  1002.     set config_file "$path/$name"
  1003.   } else {
  1004.     set config_file "$name" 
  1005.   }
  1006.   MakeInFile $config_file stdout
  1007.   SaveAsClickedCancel
  1008. }
  1009.  
  1010. proc Open { } {
  1011.   global hostfile_buffer
  1012.  
  1013.   set hostfile_buffer [.generic.frame.tframe.text get 1.0 end]
  1014.   file_window .generic OpenClickedOk OpenClickedCancel 
  1015. }
  1016.  
  1017. proc Save { } {
  1018.   global pvm_hostfile hostfile_buffer
  1019.  
  1020.   if {[catch {.generic.frame.tframe.text get 1.0 end} tmp] == 0} {
  1021.     set hostfile_buffer [.generic.frame.tframe.text get 1.0 end] }
  1022.  
  1023.   set fd [open $pvm_hostfile w+]
  1024.   if {$fd == -1} {
  1025.     error "Could not open $pvm_hostfile for reading & writing."
  1026.     SaveAsClickedCancel
  1027.     return }
  1028.   puts $fd $hostfile_buffer
  1029.   puts $fd "\n"
  1030.   close $fd
  1031. }
  1032.  
  1033. proc SaveAs { } {
  1034.   global hostfile_buffer
  1035.  
  1036.   set hostfile_buffer [.generic.frame.tframe.text get 1.0 end]
  1037.   file_window .generic SaveAsClickedOk SaveAsClickedCancel
  1038. }
  1039.  
  1040. proc Exit { } {
  1041.   exit
  1042. }
  1043.  
  1044. proc OpenClickedOK {name path} {
  1045.   global pvm_hostfile
  1046.   if {$path != ""} {
  1047.     set pvm_hostfile "$path/$name"
  1048.   } else {
  1049.     set pvm_hostfile "$name" 
  1050.   }
  1051.  
  1052.   set fd [open $pvm_hostfile a+]
  1053.   if {$fd == -1} {
  1054.     error "Could not open $pvm_hostfile for reading & writing."
  1055.     return }
  1056.   
  1057.   wm title . $pvm_hostfile
  1058.   PutText
  1059.  
  1060.   seek $fd 0 
  1061.   while {![eof $fd]} {
  1062.     .generic.frame.tframe.text insert end [read $fd 1000] }
  1063.   close $fd
  1064. }
  1065.  
  1066. proc SaveAsClickedOk {name path} {
  1067.   global pvm_hostfile hostfile_buffer
  1068.   if {$path != ""} {
  1069.     set pvm_hostfile "$path/$name"
  1070.   } else {
  1071.     set pvm_hostfile "$name" 
  1072.   }
  1073.   set fd [open $pvm_hostfile w+]
  1074.   if {$fd == -1} {
  1075.     error "Could not open $pvm_hostfile for reading and writing."
  1076.     SaveAsClickedCancel
  1077.     return
  1078.   }
  1079.   puts -nonewline $fd $hostfile_buffer
  1080.   close $fd
  1081.   OpenClickedOK $pvm_hostfile ""
  1082. }
  1083.  
  1084. proc OpenClickedCancel { } {
  1085.   global hostfile_buffer
  1086.   PutText
  1087.   .generic.frame.tframe.text insert end $hostfile_buffer
  1088.   .top.r3panel.onetest configure -state normal
  1089.   .top.r3panel.alltests configure -state normal
  1090.   .top.r3panel.allmsg configure -state normal
  1091.   .top.r3panel.allrtin configure -state normal
  1092.   .top.r3panel.fdat configure -state normal
  1093.   .top.r3panel.fndat configure -state normal
  1094.   .top.r3panel.hdat configure -state normal
  1095.   .top.r3panel.hndat configure -state normal
  1096.   .top.r3panel.tdat configure -state normal
  1097.   .top.r3panel.tndat configure -state normal
  1098.   .top.r3panel.bw configure -state normal
  1099.   .top.menu_bar.file configure -state normal
  1100.   .top.menu_bar.output configure -state normal
  1101. }
  1102.  
  1103. proc SaveAsClickedCancel { } {
  1104.   global hostfile_buffer
  1105.   PutText
  1106.   .generic.frame.tframe.text insert end $hostfile_buffer
  1107. }
  1108.  
  1109. proc MakeInFile { name output } {
  1110.   global errorCode hostfile_buffer all_comb_bool ttime_bool atime_bool atime_bool num_procs num_mesgs siz_mesgs bw_start bw_end bw_inc alltests allmsg allrtin fdat fndat hdat hndat tdat tndat bw onelabeltest
  1111.  
  1112.   exec rm -f $name
  1113.   if { $errorCode != "NONE" } {
  1114.     error "Could not remove $name."
  1115.     return 0 }
  1116.  
  1117.   set fd [open $name w]
  1118.   if { $fd == -1 } {
  1119.     error "Could not open $name for writing."
  1120.     return 0 }
  1121.  
  1122.   puts $fd "##########################################################################"
  1123.   puts $fd "#                   Input file of the pvm tester.                        #"
  1124.   puts $fd "#               To select tests put an 'x' between the two []              #"
  1125.   puts $fd "#                        each time its needed.                        #"
  1126.   puts $fd "#              For further informations read the tester manual.          #"
  1127.   puts $fd "##########################################################################"
  1128.     
  1129.   set rest $hostfile_buffer
  1130.   set cur_index 0
  1131.   set did_something 0
  1132.  
  1133.   while { 1 } {
  1134.     set cr_nl_index [string first "\n" $rest]
  1135.     if {$cr_nl_index == -1} { break }
  1136.     set line [string trim [string range $rest 0 [expr $cr_nl_index-1]]]
  1137.     set first_char [string index $line 0]
  1138.     if {($line != "") && ($first_char != "#")} {
  1139.       puts $fd "config :$line"
  1140.       set did_something 1}
  1141.     set rest [string range $rest [expr $cr_nl_index+1] end] }
  1142.  
  1143.   if {!$did_something} {
  1144.     error "There are no names in your host file."
  1145.     close $fd
  1146.     exec rm -f $name
  1147.     return 0 }
  1148.  
  1149.   if {$all_comb_bool != 0} {
  1150.     puts $fd "all_combinations :1" }
  1151.   if {$ttime_bool != 0 } {
  1152.     puts $fd "total_timing :1" }
  1153.   if {$atime_bool != 0 } {
  1154.     puts $fd "average_timing :1" }
  1155.  
  1156.   puts $fd "funneling_proc :$num_procs"
  1157.   puts $fd "num_messages :$num_mesgs"
  1158.   puts $fd "messages_length :$siz_mesgs"
  1159.  
  1160.   puts $fd "#########parameters for test 43#########"
  1161.   puts $fd "start_length :$bw_start"
  1162.   puts $fd "max_length :$bw_end"
  1163.   puts $fd "incr :$bw_inc"
  1164.   puts $fd "outfile :$output"
  1165.  
  1166.   if {$onelabeltest != ""} {
  1167.       puts $fd "\[x]$onelabeltest" }
  1168.   if {$alltests != 0} {
  1169.       puts $fd "all_tests :1"}
  1170.   if {$allmsg != 0} {
  1171.       puts $fd "all_messaging :1" }
  1172.   if {$allrtin != 0} {
  1173.       puts $fd "all_routine :1" }
  1174.   if {$fndat != 0} {
  1175.       puts $fd "all_funnel_nodata :1" }
  1176.   if {$fdat != 0} {
  1177.       puts $fd "all_funnel_data :1" }
  1178.   if {$hndat != 0} {
  1179.       puts $fd "all_head_nodata :1" }
  1180.   if {$hdat != 0} {
  1181.       puts $fd "all_head_data :1" }
  1182.   if {$tndat != 0} {
  1183.       puts $fd "all_triangle_nodata :1" }
  1184.   if {$tdat != 0} {
  1185.       puts $fd "all_triangle_data :1" }
  1186.   if {$bw != 0} {
  1187.       puts $fd "all_perf :1" }
  1188.   close $fd
  1189.   return 1
  1190. }
  1191.  
  1192.  
  1193.  
  1194.  
  1195. proc bw_graph {} {
  1196. global pvm_test_pid
  1197.  
  1198.   if {[file readable /tmp/pt.d1.$pvm_test_pid] == 0} { return }
  1199.   if {[file readable /tmp/pt.d2.$pvm_test_pid] == 0} { return }
  1200.  
  1201.   set fd [open "/tmp/ptg.gnuplot.$pvm_test_pid" w]
  1202.   if {$fd < 0} {
  1203.     error "Could not create /tmp/ptg.gnuplot.$pvm_test_pid (GNUPLOT script file)"
  1204.     return 0 }
  1205.  
  1206.   puts $fd "set xlabel \"Number of bytes\""
  1207.   puts $fd "set ylabel \"Time in seconds\""
  1208.   puts $fd "set tics out"
  1209.   puts $fd "set data style linespoints"
  1210.   puts $fd "set autoscale"
  1211.   puts $fd "set term postscript landscape \"Times-Roman\" 14"
  1212.   puts $fd "set output \"/tmp/ptg.ps.$pvm_test_pid\""
  1213.   puts $fd "set title \"Bandwidth measurement from [exec hostname] on [exec date]\""
  1214.   puts $fd "plot \"/tmp/pt.d1.$pvm_test_pid\" using 1:2 title \"Measurement\" with lines 1 ,\"/tmp/pt.d2.$pvm_test_pid\" using 1:2 title \"Linear regression\" with lines 2"
  1215.   puts $fd "set yrange\[0.0001:0.001]"
  1216.   close $fd
  1217.  
  1218.   set retval [catch {exec gnuplot "/tmp/ptg.gnuplot.$pvm_test_pid" }]
  1219.   if {$retval != 0} {
  1220.     error "Could not run gnuplot: data saved in /tmp/pt.d1.$pvm_test_pid & /tmp/pt.d2.$pvm_test_pid; gnuplot script saved in /tmp/ptg.gnuplot.$pvm_test_pid"
  1221.     return 0 }
  1222.  
  1223.   set retval [catch {exec gs "/tmp/ptg.ps.$pvm_test_pid" >/dev/null 2>/dev/null &}]
  1224.   if {$retval != 0} {
  1225.     error "Could not run ghostscript to preview to graph" }
  1226.   exec rm -f /tmp/ptg.gnuplot.$pvm_test_pid /tmp/pt.d1.$pvm_test_pid /tmp/pt.d2.$pvm_test_pid /tmp/pt.ps.$pvm_test_pid
  1227.   return 1
  1228. }
  1229.  
  1230. proc PutTop { } {
  1231. frame .top 
  1232. pack .top -fill x
  1233. bind .top <Destroy> {
  1234.   exec rm -f /tmp/pt*$pvm_test_gui_pid }
  1235. }
  1236.  
  1237. #
  1238. # main()
  1239. #
  1240.  
  1241. PutTop
  1242. PutMenus 
  1243. PutHelp
  1244. PutGeneric .generic
  1245. PutSliders
  1246. PutActionButtons
  1247. PutCheckButtons
  1248.  
  1249. if {[catch {set pvm_root $env(PVM_ROOT)}]} {
  1250.   tkerror "You must set the PVM_ROOT environment variable."
  1251.   exit 1 }
  1252. if {[file executable $pvm_root/lib/pvmgetarch] == 0} {
  1253.   if {[catch {set pvm_arch $env(PVM_ARCH)}]} {
  1254.     tkerror "You must set the PVM_ARCH environment variable."
  1255.     exit 1 } 
  1256.   } else {
  1257.   set pvm_arch [exec $pvm_root/lib/pvmgetarch] }
  1258. if {[file executable ~/pvm3/bin/$pvm_arch/pvm_test] == 0} {
  1259.   tkerror "Could not find pvm_test in ~/pvm3/bin/$pvm_arch."
  1260.   exit 1 }
  1261. if {$argc == 1} {
  1262.   OpenClickedOK [lindex $argv 0] "" 
  1263. } elseif {$argc > 1} {
  1264.   puts stderr "Usage: $argv0 \[filename]"
  1265.   exit 1
  1266. } else {
  1267.   set pvm_hostfile "/tmp/ptg.hosts.$pvm_test_gui_pid"
  1268.   set f [open $pvm_hostfile w]
  1269.   if { $f == -1 } {
  1270.     tkerror "Could not create $pvm_hostfile." 
  1271.     exit 1 }
  1272.   puts $f "# This is your PVM host configuration file."
  1273.   puts $f [exec hostname]
  1274.   close $f
  1275.   OpenClickedOK $pvm_hostfile "" 
  1276.   wm title . $pvm_hostfile }
  1277.